// 主框架载入
// vue-router 测试利用
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Router from 'vue-router'

// 菜单控件以及页面载入
import Menu from '../components/menu.vue'
import Footer from '../components/footer.vue'
// 公共js函数库
import Center from '../center.vue.js'

// 模块组件
import Main from './plan/main.vue'
import Edit from './plan/edit.vue'

// 注册组件为 vue 扩展
Vue.use(Center)
Vue.use(Router)

Vue.use(ElementUI)


// 菜单
var menu = new Vue({
  el: '#menu',
  render: h => h(Menu)
})

// 页面内容

const routes = [
  { path: '/list', component: Main },
  { path: '/add', component: Edit },
  { path: '/view/:no', component: Edit, name:'view'},   // 查看界面
  { path: '/edit/:no', component: Edit, name:'edit'},   // 编辑界面
]

const router = new Router({
  routes // （缩写）相当于 routes: routes
})

const layout = new Vue({
  router
}).$mount('#layout')
// 默认路由
if(!location.hash || '#/' == location.hash) location.href = '#/list';



// 页脚
var footer = new Vue({
    el: '#footer',    
    render: h => h(Footer)
});
